#ifndef MONO_COMMON_SCOPEDLOCK_H_
#define MONO_COMMON_SCOPEDLOCK_H_
#include <assert.h>
namespace mono {

template <typename LOCK>

class ScopedLock {
public:
    explicit ScopedLock(LOCK* lock)
    {
        _lock = lock;
        if (_lock)
            _lock->lock();
    }
    ~ScopedLock()
    {
      if (_lock)
        _lock->unlock();  
    }
private:
    LOCK* _lock;
};
class Mutex;
typedef ScopedLock<Mutex> ScopedMutex;

}
#endif
